#include "pch.h"
#include <regex>
#include <string>
#include<fstream>
#include <vector>
#include <iostream>
#include "CLogRecord.h"
using namespace std;
#ifdef DEBUG
ofstream out("dllout.log");
#endif
LOG_DLL int parseLogByFile(string fil_dir,vector<CLogRecord> &m_vLogRecord)
{
#ifdef DEBUG
	out << "-----------------------------" << endl;
#endif
	std::ifstream f_stream(fil_dir);
	if (f_stream.is_open())
	{
		string line;
		while (getline(f_stream, line,'\n'))
		{
#ifdef DEBUG
			out << "line " << line << endl;
#endif
			CLogRecord logRecord(line);
			m_vLogRecord.push_back(logRecord);
		}

		f_stream.close();
		if (!m_vLogRecord.size())
		{

			return -2;
		}
	}
	else
	{
		return -1;
	}
	return 0;
}